import React from 'react';
import {Tabs} from 'antd-mobile';

export default class CustomTabs extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      current: 0
    }
  }

  renderContent = tab => {
    const {component: Component, from} = tab;
    return (<div>
      <Component from={from}></Component>
    </div>);
  }

  render() {
    // const {current} = this.state;
    const {tabs} = this.props
    return (
      <div>
        <Tabs tabs={tabs}
              onChange={(tab, index) => {
                this.setState({
                  current: index
                });
              }}
              renderTabBar={props => <Tabs.DefaultTabBar {...props} page={5}/>}
        >
          {
            this.renderContent
          }
        </Tabs>
      </div>
    )
  }
}
